<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>Crawler: Source/Crawler/WebsiteManager.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Crawler
   &#160;<span id="projectnumber">1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_website_manager_8cpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">WebsiteManager.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_website_manager_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_website_manager_8hpp.html">Crawler/WebsiteManager.hpp</a>&gt;</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_application_8hpp.html">Crawler/Application.hpp</a>&gt;</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_scoped_mutex_8hpp.html">Crawler/ScopedMutex.hpp</a>&gt;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;</div>
<div class="line"><a name="l00005"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a5a030384d9b5f0adf15a1d051256c5fe">    5</a></span>&#160;<a class="code" href="class_crawler_1_1_website_manager.html#a5a030384d9b5f0adf15a1d051256c5fe">Crawler::WebsiteManager::WebsiteManager</a> ( <a class="code" href="class_crawler_1_1_application.html">Crawler::Application</a> &amp; application ) :</div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;    application ( application )</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;{</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;}</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;</div>
<div class="line"><a name="l00010"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#aa5bfdf43dbee41e408aae5df57159824">   10</a></span>&#160;<a class="code" href="class_crawler_1_1_application.html">Crawler::Application</a> &amp; <a class="code" href="class_crawler_1_1_website_manager.html#aa5bfdf43dbee41e408aae5df57159824">Crawler::WebsiteManager::getApplication</a> ( )</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;{</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;    <span class="keywordflow">return</span> this-&gt;application ;</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;}</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a9845375139da6d2e002daf2a14a0ae26">   15</a></span>&#160;<span class="keyword">const</span> <a class="code" href="class_crawler_1_1_application.html">Crawler::Application</a> &amp; <a class="code" href="class_crawler_1_1_website_manager.html#aa5bfdf43dbee41e408aae5df57159824">Crawler::WebsiteManager::getApplication</a> ( )<span class="keyword"> const</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    <span class="keywordflow">return</span> this-&gt;application ;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;}</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;        </div>
<div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a0da0227729636655190bb8679f5cbd39">   20</a></span>&#160;<a class="code" href="class_crawler_1_1_website_manager.html#a73a0d579dfd90c0f5eab55c0f0ae82a8">Crawler::WebsiteManager::Iterator</a> <a class="code" href="class_crawler_1_1_website_manager.html#a0da0227729636655190bb8679f5cbd39">Crawler::WebsiteManager::begin</a> ( )</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;{</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    <span class="keywordflow">return</span> this-&gt;websites.begin ( ) ;</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;}</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a02f632879597f127a978ffbb6dc532a3">   25</a></span>&#160;<a class="code" href="class_crawler_1_1_website_manager.html#a5540e8864e8c8defbf06ebfc3aa6c7c8">Crawler::WebsiteManager::ConstIterator</a> <a class="code" href="class_crawler_1_1_website_manager.html#a0da0227729636655190bb8679f5cbd39">Crawler::WebsiteManager::begin</a> ( )<span class="keyword"> const</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <span class="keywordflow">return</span> this-&gt;websites.begin ( ) ;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;}</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a574b34605ba1629e890e577a22c167f0">   30</a></span>&#160;<a class="code" href="class_crawler_1_1_website_manager.html#a5540e8864e8c8defbf06ebfc3aa6c7c8">Crawler::WebsiteManager::ConstIterator</a> <a class="code" href="class_crawler_1_1_website_manager.html#a574b34605ba1629e890e577a22c167f0">Crawler::WebsiteManager::cbegin</a> ( )<span class="keyword"> const</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    <span class="keywordflow">return</span> this-&gt;websites.cbegin ( ) ;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;}</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#ad96ddfa5b856df683c2742bb63662c0c">   35</a></span>&#160;<a class="code" href="class_crawler_1_1_website_manager.html#a73a0d579dfd90c0f5eab55c0f0ae82a8">Crawler::WebsiteManager::Iterator</a> <a class="code" href="class_crawler_1_1_website_manager.html#ad96ddfa5b856df683c2742bb63662c0c">Crawler::WebsiteManager::end</a> ( )</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;{</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    <span class="keywordflow">return</span> this-&gt;websites.end ( ) ;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;}</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#adf7b27efbd44be2a7f8be01a4e57a2f8">   40</a></span>&#160;<a class="code" href="class_crawler_1_1_website_manager.html#a5540e8864e8c8defbf06ebfc3aa6c7c8">Crawler::WebsiteManager::ConstIterator</a> <a class="code" href="class_crawler_1_1_website_manager.html#ad96ddfa5b856df683c2742bb63662c0c">Crawler::WebsiteManager::end</a> ( )<span class="keyword"> const</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;    <span class="keywordflow">return</span> this-&gt;websites.end ( ) ;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;}</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;</div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a18aad5f4a56da5d2f31e17b9c75e6dc4">   45</a></span>&#160;<a class="code" href="class_crawler_1_1_website_manager.html#a5540e8864e8c8defbf06ebfc3aa6c7c8">Crawler::WebsiteManager::ConstIterator</a> <a class="code" href="class_crawler_1_1_website_manager.html#a18aad5f4a56da5d2f31e17b9c75e6dc4">Crawler::WebsiteManager::cend</a> ( )<span class="keyword"> const</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <span class="keywordflow">return</span> this-&gt;websites.cend ( ) ;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;}</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a226f24b306bb60ba3ffda550296b97a4">   50</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_crawler_1_1_website_manager.html#a226f24b306bb60ba3ffda550296b97a4">Crawler::WebsiteManager::existsWebsite</a> ( <span class="keyword">const</span> <a class="code" href="class_crawler_1_1_website.html">Crawler::Website</a> &amp; website )</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;{</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    <span class="keywordflow">for</span> ( <span class="keyword">auto</span> &amp; element : this-&gt;websites )</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;        <span class="keywordflow">if</span> ( element == website )</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;            <span class="keywordflow">return</span> true ;</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <span class="keywordflow">return</span> false ;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;}</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;</div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#ac0caf44a0602ab60f947f2a282069135">   59</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_crawler_1_1_website_manager.html#ac0caf44a0602ab60f947f2a282069135">Crawler::WebsiteManager::addWebsite</a> ( <span class="keyword">const</span> <a class="code" href="class_crawler_1_1_website.html">Crawler::Website</a> &amp; website )</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;{</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <a class="code" href="class_crawler_1_1_scoped_mutex.html">Crawler::ScopedMutex</a> mutex ( this-&gt;mutex ) ;</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <span class="keywordflow">if</span> ( ! this-&gt;existsWebsite ( website ) )</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;        this-&gt;websites.push_back ( website ) ;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;}</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;</div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#ab148782b9fc087c25ddfa1ae2b53c9c7">   66</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_crawler_1_1_website_manager.html#ab148782b9fc087c25ddfa1ae2b53c9c7">Crawler::WebsiteManager::removeWebsite</a> ( <span class="keyword">const</span> <a class="code" href="class_crawler_1_1_website.html">Crawler::Website</a> &amp; website )</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;{</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <a class="code" href="class_crawler_1_1_scoped_mutex.html">Crawler::ScopedMutex</a> mutex ( this-&gt;mutex ) ;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    <span class="keywordflow">for</span> ( <span class="keyword">auto</span> iterator = this-&gt;websites.begin ( ) ; iterator != this-&gt;websites.end ( ) ; ++iterator )</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    {</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        <span class="keywordflow">if</span> ( * iterator == website )</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;        {</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            this-&gt;websites.erase ( iterator ) ;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;            break ;</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;        }</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    }</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;}</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;</div>
<div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#af33f67f613ab2110790e30670390dfcb">   79</a></span>&#160;<a class="code" href="class_crawler_1_1_website_manager.html#a73a0d579dfd90c0f5eab55c0f0ae82a8">Crawler::WebsiteManager::Iterator</a> <a class="code" href="class_crawler_1_1_website_manager.html#ab148782b9fc087c25ddfa1ae2b53c9c7">Crawler::WebsiteManager::removeWebsite</a> ( <a class="code" href="class_crawler_1_1_website_manager.html#a73a0d579dfd90c0f5eab55c0f0ae82a8">Iterator</a> iterator )</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;{</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <a class="code" href="class_crawler_1_1_scoped_mutex.html">Crawler::ScopedMutex</a> mutex ( this-&gt;mutex ) ;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="keywordflow">return</span> this-&gt;websites.erase ( iterator ) ;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;}</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;</div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#abb40067a259c4c1cb274a30e4259e09b">   85</a></span>&#160;<span class="keyword">const</span> std::list &lt;Crawler::Website&gt; &amp; <a class="code" href="class_crawler_1_1_website_manager.html#abb40067a259c4c1cb274a30e4259e09b">Crawler::WebsiteManager::getWebsites</a> ( )<span class="keyword"> const</span></div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    <span class="keywordflow">return</span> this-&gt;websites ;</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;}</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#addf1f3b0bf194c14ed1b77dd8a8eaf1b">   90</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_crawler_1_1_website_manager.html#addf1f3b0bf194c14ed1b77dd8a8eaf1b">Crawler::WebsiteManager::setWorkerPerWebsite</a> ( std::size_t workerPerWebsite )</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;{</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <a class="code" href="class_crawler_1_1_scoped_mutex.html">Crawler::ScopedMutex</a> mutex ( this-&gt;mutex ) ;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    this-&gt;workerPerWebsite = workerPerWebsite ;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;}</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;</div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a28f65de487a2006d00d44c157efbf45a">   96</a></span>&#160;std::size_t <a class="code" href="class_crawler_1_1_website_manager.html#a28f65de487a2006d00d44c157efbf45a">Crawler::WebsiteManager::getWorkerPerWebsite</a> ( )<span class="keyword"> const</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="keywordflow">return</span> this-&gt;workerPerWebsite ;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;}</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;</div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a2df4537dc3e42b2888491cafd463f80e">  101</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_crawler_1_1_website_manager.html#a2df4537dc3e42b2888491cafd463f80e">Crawler::WebsiteManager::reportLink</a> ( <span class="keyword">const</span> std::string &amp; <span class="keywordtype">string</span> )</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;{</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    <a class="code" href="class_crawler_1_1_scoped_mutex.html">Crawler::ScopedMutex</a> mutex ( this-&gt;mutex ) ;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <span class="keywordflow">if</span> ( ! this-&gt;getApplication ( ).onReportLink ( <span class="keywordtype">string</span> ) )</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        return ;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <a class="code" href="class_crawler_1_1_website.html">Crawler::Website</a> website ( <span class="keywordtype">string</span> ) ;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    </div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="keywordflow">if</span> ( website.<a class="code" href="class_crawler_1_1_website.html#a332143681603ea9dc70dfbfe5b8c1b95">getScheme</a> ( ).empty ( ) || website.<a class="code" href="class_crawler_1_1_website.html#a108463b7bc848fb9b86b7b7601f94f68">getAuthority</a> ( ).empty ( ) )</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;        <span class="keywordflow">return</span> ;</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;        </div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <a class="code" href="class_crawler_1_1_link.html">Crawler::Link</a> link ( <span class="keywordtype">string</span> ) ;</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    </div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="keywordflow">for</span> ( <span class="keyword">auto</span> &amp; element : this-&gt;websites )</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    {</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;        <span class="keywordflow">if</span> ( element == website )</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        {</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;            <span class="keywordflow">if</span> ( this-&gt;getApplication ( ).onAddLink ( element , link ) )</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;                element.addLink ( link ) ;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;                </div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;            return ;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;        }</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    }</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    </div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keywordflow">if</span> ( ! this-&gt;getApplication ( ).onAddWebsite ( website ) )</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        return ;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;        </div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    <span class="keywordflow">if</span> ( this-&gt;getApplication ( ).onAddLink ( website , link ) )</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        website.<a class="code" href="class_crawler_1_1_website.html#ae329d422dadf492168d97e60d1665a50">addLink</a> ( link ) ;</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    </div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;    this-&gt;websites.push_back ( website ) ;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;}</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;</div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="line" href="class_crawler_1_1_website_manager.html#a128ba5c4f12e5d445c1b786af67f2301">  134</a></span>&#160;<a class="code" href="class_crawler_1_1_website.html">Crawler::Website</a> * <a class="code" href="class_crawler_1_1_website_manager.html#a128ba5c4f12e5d445c1b786af67f2301">Crawler::WebsiteManager::requestWebsite</a> ( <a class="code" href="class_crawler_1_1_worker.html">Crawler::Worker</a> * worker )</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;{</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    <a class="code" href="class_crawler_1_1_scoped_mutex.html">Crawler::ScopedMutex</a> mutex ( this-&gt;mutex ) ;</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;    <span class="keywordflow">for</span> ( <span class="keyword">auto</span> &amp; website : this-&gt;websites )</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    {</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        <span class="keywordflow">if</span> ( ! website.wasVisited ( ) &amp;&amp; ( this-&gt;workerPerWebsite == 0 || website.getWorker ( ).size ( ) &lt;= this-&gt;workerPerWebsite ) )</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        {</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;            website.registerWorker ( * worker ) ;</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;            <span class="keywordflow">return</span> &amp; website ;</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        }</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    }</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="keywordflow">return</span> nullptr ;</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;}</div>
<div class="ttc" id="class_crawler_1_1_scoped_mutex_html"><div class="ttname"><a href="class_crawler_1_1_scoped_mutex.html">Crawler::ScopedMutex</a></div><div class="ttdef"><b>Definition:</b> <a href="_scoped_mutex_8hpp_source.html#l00012">ScopedMutex.hpp:12</a></div></div>
<div class="ttc" id="_website_manager_8hpp_html"><div class="ttname"><a href="_website_manager_8hpp.html">WebsiteManager.hpp</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a128ba5c4f12e5d445c1b786af67f2301"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a128ba5c4f12e5d445c1b786af67f2301">Crawler::WebsiteManager::requestWebsite</a></div><div class="ttdeci">Crawler::Website * requestWebsite(Crawler::Worker *worker)</div><div class="ttdoc">Requests a new website from the list which is handled by the worker. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00134">WebsiteManager.cpp:134</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_html_ae329d422dadf492168d97e60d1665a50"><div class="ttname"><a href="class_crawler_1_1_website.html#ae329d422dadf492168d97e60d1665a50">Crawler::Website::addLink</a></div><div class="ttdeci">void addLink(const Crawler::Link &amp;link)</div><div class="ttdoc">Adds a link to the website. </div><div class="ttdef"><b>Definition:</b> <a href="_website_8cpp_source.html#l00138">Website.cpp:138</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a0da0227729636655190bb8679f5cbd39"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a0da0227729636655190bb8679f5cbd39">Crawler::WebsiteManager::begin</a></div><div class="ttdeci">Iterator begin()</div><div class="ttdoc">Returns begin iterator. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00020">WebsiteManager.cpp:20</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a18aad5f4a56da5d2f31e17b9c75e6dc4"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a18aad5f4a56da5d2f31e17b9c75e6dc4">Crawler::WebsiteManager::cend</a></div><div class="ttdeci">ConstIterator cend() const </div><div class="ttdoc">Returns end iterator. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00045">WebsiteManager.cpp:45</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_html_a108463b7bc848fb9b86b7b7601f94f68"><div class="ttname"><a href="class_crawler_1_1_website.html#a108463b7bc848fb9b86b7b7601f94f68">Crawler::Website::getAuthority</a></div><div class="ttdeci">const std::string &amp; getAuthority() const </div><div class="ttdoc">Returns authority. </div><div class="ttdef"><b>Definition:</b> <a href="_website_8cpp_source.html#l00119">Website.cpp:119</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a2df4537dc3e42b2888491cafd463f80e"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a2df4537dc3e42b2888491cafd463f80e">Crawler::WebsiteManager::reportLink</a></div><div class="ttdeci">void reportLink(const std::string &amp;string)</div><div class="ttdoc">Report a link to website manager. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00101">WebsiteManager.cpp:101</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_html"><div class="ttname"><a href="class_crawler_1_1_website.html">Crawler::Website</a></div><div class="ttdef"><b>Definition:</b> <a href="_website_8hpp_source.html#l00014">Website.hpp:14</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_ad96ddfa5b856df683c2742bb63662c0c"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#ad96ddfa5b856df683c2742bb63662c0c">Crawler::WebsiteManager::end</a></div><div class="ttdeci">Iterator end()</div><div class="ttdoc">Returns end iterator. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00035">WebsiteManager.cpp:35</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a574b34605ba1629e890e577a22c167f0"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a574b34605ba1629e890e577a22c167f0">Crawler::WebsiteManager::cbegin</a></div><div class="ttdeci">ConstIterator cbegin() const </div><div class="ttdoc">Returns begin iterator. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00030">WebsiteManager.cpp:30</a></div></div>
<div class="ttc" id="class_crawler_1_1_link_html"><div class="ttname"><a href="class_crawler_1_1_link.html">Crawler::Link</a></div><div class="ttdoc">Utility class which represents a link. </div><div class="ttdef"><b>Definition:</b> <a href="_link_8hpp_source.html#l00012">Link.hpp:12</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_aa5bfdf43dbee41e408aae5df57159824"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#aa5bfdf43dbee41e408aae5df57159824">Crawler::WebsiteManager::getApplication</a></div><div class="ttdeci">Crawler::Application &amp; getApplication()</div><div class="ttdoc">Returns assigned application. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00010">WebsiteManager.cpp:10</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a28f65de487a2006d00d44c157efbf45a"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a28f65de487a2006d00d44c157efbf45a">Crawler::WebsiteManager::getWorkerPerWebsite</a></div><div class="ttdeci">std::size_t getWorkerPerWebsite() const </div><div class="ttdoc">Returns the amount of workers per website. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00096">WebsiteManager.cpp:96</a></div></div>
<div class="ttc" id="class_crawler_1_1_application_html"><div class="ttname"><a href="class_crawler_1_1_application.html">Crawler::Application</a></div><div class="ttdef"><b>Definition:</b> <a href="_application_8hpp_source.html#l00013">Application.hpp:13</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_ab148782b9fc087c25ddfa1ae2b53c9c7"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#ab148782b9fc087c25ddfa1ae2b53c9c7">Crawler::WebsiteManager::removeWebsite</a></div><div class="ttdeci">void removeWebsite(const Crawler::Website &amp;website)</div><div class="ttdoc">Remove website from manager. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00066">WebsiteManager.cpp:66</a></div></div>
<div class="ttc" id="_scoped_mutex_8hpp_html"><div class="ttname"><a href="_scoped_mutex_8hpp.html">ScopedMutex.hpp</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a73a0d579dfd90c0f5eab55c0f0ae82a8"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a73a0d579dfd90c0f5eab55c0f0ae82a8">Crawler::WebsiteManager::Iterator</a></div><div class="ttdeci">typename std::list&lt; Crawler::Website &gt;::iterator Iterator</div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8hpp_source.html#l00015">WebsiteManager.hpp:15</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_abb40067a259c4c1cb274a30e4259e09b"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#abb40067a259c4c1cb274a30e4259e09b">Crawler::WebsiteManager::getWebsites</a></div><div class="ttdeci">const std::list&lt; Crawler::Website &gt; &amp; getWebsites() const </div><div class="ttdoc">Returns list of websites. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00085">WebsiteManager.cpp:85</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a5540e8864e8c8defbf06ebfc3aa6c7c8"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a5540e8864e8c8defbf06ebfc3aa6c7c8">Crawler::WebsiteManager::ConstIterator</a></div><div class="ttdeci">typename std::list&lt; Crawler::Website &gt;::const_iterator ConstIterator</div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8hpp_source.html#l00016">WebsiteManager.hpp:16</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a5a030384d9b5f0adf15a1d051256c5fe"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a5a030384d9b5f0adf15a1d051256c5fe">Crawler::WebsiteManager::WebsiteManager</a></div><div class="ttdeci">WebsiteManager(Crawler::Application &amp;application)</div><div class="ttdoc">Constructor. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00005">WebsiteManager.cpp:5</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_ac0caf44a0602ab60f947f2a282069135"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#ac0caf44a0602ab60f947f2a282069135">Crawler::WebsiteManager::addWebsite</a></div><div class="ttdeci">void addWebsite(const Crawler::Website &amp;website)</div><div class="ttdoc">Add website to manager. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00059">WebsiteManager.cpp:59</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_a226f24b306bb60ba3ffda550296b97a4"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#a226f24b306bb60ba3ffda550296b97a4">Crawler::WebsiteManager::existsWebsite</a></div><div class="ttdeci">bool existsWebsite(const Crawler::Website &amp;website)</div><div class="ttdoc">Checks if website exists. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00050">WebsiteManager.cpp:50</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_manager_html_addf1f3b0bf194c14ed1b77dd8a8eaf1b"><div class="ttname"><a href="class_crawler_1_1_website_manager.html#addf1f3b0bf194c14ed1b77dd8a8eaf1b">Crawler::WebsiteManager::setWorkerPerWebsite</a></div><div class="ttdeci">void setWorkerPerWebsite(std::size_t workerPerWebsite)</div><div class="ttdoc">Changes the amount of workers per website. </div><div class="ttdef"><b>Definition:</b> <a href="_website_manager_8cpp_source.html#l00090">WebsiteManager.cpp:90</a></div></div>
<div class="ttc" id="class_crawler_1_1_worker_html"><div class="ttname"><a href="class_crawler_1_1_worker.html">Crawler::Worker</a></div><div class="ttdef"><b>Definition:</b> <a href="_worker_8hpp_source.html#l00019">Worker.hpp:19</a></div></div>
<div class="ttc" id="_application_8hpp_html"><div class="ttname"><a href="_application_8hpp.html">Application.hpp</a></div></div>
<div class="ttc" id="class_crawler_1_1_website_html_a332143681603ea9dc70dfbfe5b8c1b95"><div class="ttname"><a href="class_crawler_1_1_website.html#a332143681603ea9dc70dfbfe5b8c1b95">Crawler::Website::getScheme</a></div><div class="ttdeci">const std::string &amp; getScheme() const </div><div class="ttdoc">Returns scheme. </div><div class="ttdef"><b>Definition:</b> <a href="_website_8cpp_source.html#l00108">Website.cpp:108</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_74389ed8173ad57b461b9d623a1f3867.html">Source</a></li><li class="navelem"><a class="el" href="dir_07db96ce4b3001379d5b50a5cb9d08c0.html">Crawler</a></li><li class="navelem"><a class="el" href="_website_manager_8cpp.html">WebsiteManager.cpp</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
  </ul>
</div>
</body>
</html>
